class Point {
    constructor(x, y) {
        this.x = x;
        this.y = y;
        this.init();

        Point.cnt++;
    }

    init() {
        this.sum = this.x + this.y;
    }

    toString(){
        return `x: ${this.x}\ny: ${this.y}\n`;
    }

    static PrintCnt() {
        console.log(Point.cnt);
    }
}

Point.cnt = 0;

// let p = new Point(1, 2);
// console.log(p.toString())

class ColorPoint extends Point{
    constructor(x, y, c) {
        super(x, y);
        this.color = c;
    }

    toString(){
        return super.toString() + `color: ${this.color}\n`;
    }
}

let cp = new ColorPoint(1, 2, "red");
let cp2 = new ColorPoint(1, 2, "red");
let cp3 = new ColorPoint(1, 2, "red");
console.log(cp.toString());
Point.PrintCnt();